package com.weayer.request;

import com.weayer.constraints.DicCheck;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * @description: 预估价格请求
 * @author: Weayer
 **/
@Data
public class ForecastPriceDTO {


    @NotBlank(message = "起点经度不能为空")
    @Pattern(regexp = "^[\\-\\+]?(0?\\d{1,2}\\.\\d{1,6}|1[0-7]\\d{1}\\.\\d{1,6}|180\\.0{1,6})$",message = "请输入正确的起点经度")
    private String depLongitude;    // 起点经度 -180 ~ 180

    @NotBlank(message = "起点纬度不能为空")
    @Pattern(regexp = "^[\\-\\+]?([0-8]?\\d{1}\\.\\d{1,6}|90\\.0{1,6})$",message = "请输入正确的起点纬度")
    private String depLatitude;     // 起点纬度 -90 ~ 90

    @NotBlank(message = "终点经度不能为空")
    @Pattern(regexp = "^[\\-\\+]?(0?\\d{1,2}\\.\\d{1,6}|1[0-7]\\d{1}\\.\\d{1,6}|180\\.0{1,6})$",message = "请输入正确的终点经度")
    private String desLongitude;    // 终点经度 -180 ~ 180

    @NotBlank(message = "终点纬度不能为空")
    @Pattern(regexp = "^[\\-\\+]?([0-8]?\\d{1}\\.\\d{1,6}|90\\.0{1,6})$",message = "请输入正确的终点纬度")
    private String desLatitude;     // 终点纬度 -90 ~ 90

    @NotBlank(message = "城市码不能为空")
    @Pattern(regexp = "^\\d{6}$",message = "请输入正确的城市码")
    private String cityCode;        // 城市代码

    @NotBlank(message = "车辆类型不能为空")
//    @Pattern(regexp = "^1$",message = "请输入正确的车辆类型")
    @DicCheck(dicValue = {"1","2"}, message = "请输入正确的车辆类型")
    private String vehicleType;     // 车辆类型 1

    public ForecastPriceDTO() {
    }

    public ForecastPriceDTO(String depLongitude, String depLatitude, String desLongitude, String desLatitude) {
        this.depLongitude = depLongitude;
        this.depLatitude = depLatitude;
        this.desLongitude = desLongitude;
        this.desLatitude = desLatitude;
    }

    public ForecastPriceDTO(String depLongitude, String depLatitude, String desLongitude, String desLatitude, String cityCode, String vehicleType) {
        this.depLongitude = depLongitude;
        this.depLatitude = depLatitude;
        this.desLongitude = desLongitude;
        this.desLatitude = desLatitude;
        this.vehicleType = vehicleType;
        this.cityCode = cityCode;
    }
}
